home *** CD-ROM | disk | FTP | other *** search
- var eyeShown = false;
- var animation = {duration:0, starttime:0, to:1.0, now:0.0, from:0.0, firstElement:null, timer:null};
-
- /// Calling these next two will cause the "i" button that flips the
- /// widget to fade in and fade out, respectively.
- function fadeInEye(){
- if (!eyeShown){
- if (animation.timer != null){
- clearInterval (animation.timer);
- animation.timer = null;
- }
-
- var starttime = (new Date).getTime() - 13;
-
- animation.duration = 500;
- animation.starttime = starttime;
- animation.firstElement = document.getElementById('eyeFront');
- animation.timer = setInterval ("animate();", 13);
- animation.from = animation.now;
- animation.to = 1.0;
- animate();
- eyeShown = true;
- }
- }
-
-
- function fadeOutEye(){
- if (eyeShown){
- if (animation.timer != null){
- clearInterval (animation.timer);
- animation.timer = null;
- }
-
- var starttime = (new Date).getTime() - 13;
-
- animation.duration = 500;
- animation.starttime = starttime;
- animation.firstElement = document.getElementById ('eyeFront');
- animation.timer = setInterval ("animate();", 13);
- animation.from = animation.now;
- animation.to = 0.0;
- animate();
- eyeShown = false;
- }
- }
-
-
- /// These flip the widget from front to back, and from back to front,
- /// respectively.
- function doFlipToBack(){
- var front = document.getElementById("front");
- var back = document.getElementById("back");
-
- if(window.widget){
- widget.prepareForTransition("ToBack");
- }
-
- front.style.display="none";
- back.style.display="block";
-
- if(window.widget){
- setTimeout("widget.performTransition();", 0);
- }
- }
-
-
- function doFlipToFront(){
- var front = document.getElementById("front");
- var back = document.getElementById("back");
-
- if(window.widget){
- widget.prepareForTransition("ToFront");
- }
-
- // document.getElementById("doneButton").src = "done.png";
-
- back.style.display="none";
- front.style.display="block";
-
- if(window.widget){
- setTimeout("widget.performTransition();", 0);
- }
- }
-
-
-
- random.m=714025; random.a=1366; random.c=150889;
- random.seed = (new Date()).getTime()%random.m;
- function random() {
- random.seed = (random.seed * random.a + random.c) % random.m;
- return random.seed / random.m;
- }
-
-
- function giveTheFinger(){
- document.body.style.cursor = "hand";
- }
-
-
- function putItAway(){
- document.body.style.cursor = "default";
- }
-
-
- function animate(){
- var T;
- var ease;
- var time = (new Date).getTime();
-
- T = limit_3(time-animation.starttime, 0, animation.duration);
-
- if (T >= animation.duration){
- clearInterval (animation.timer);
- animation.timer = null;
- animation.now = animation.to;
-
- }else{
- ease = 0.5 - (0.5 * Math.cos(Math.PI * T / animation.duration));
- animation.now = computeNextFloat (animation.from, animation.to, ease);
- }
-
- animation.firstElement.style.opacity = animation.now;
- }
-
-
- /// Support function for animate()
- function limit_3 (a, b, c){
- return a<b ? b : (a>c ? c : a);
- }
-
-
- /// Support function for animate()
- function computeNextFloat (from, to, ease){
- return from + (to - from) * ease;
- }
-
- function version(){
- var xmlReq = new XMLHttpRequest();
- xmlReq.open("GET", "Info.plist", false);
- xmlReq.send(null);
-
- var xml = xmlReq.responseXML;
- var keys = xml.getElementsByTagName("key");
- var ver = "0.0";
-
- for(i=0; i<keys.length; i++){
- if("CFBundleVersion" == keys[i].firstChild.data){
- ver = keys[i].nextSibling.nextSibling.firstChild.data;
- break;
- }
- }
-
- return ver;
- }
-
- function showEyeBack(){
- document.getElementById('eyeBack').style.display = "block";
- }
-
-
- function hideEyeBack(){
- document.getElementById('eyeBack').style.display = "none";
- }